<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">
    <title>编辑厂商</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>js/bootstrap-3.3.6/dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/bootstrapValidator.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/mydialog.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css"/>
</head>
<body>
<div id="index-hav2">
    <div class="index-hav-right" id="index-hav-right-clear">
        <div class="row">
            <div class="col-md-9">
                <span id="icon-house"> </span><span>首页</span> <span>></span><span>系统管理</span> <span
                    id="arrows-left">></span><span>厂商管理</span>
            </div>
            <div class="bank-box">
                <div class="lianlian platform">
                    <div class="col-md-12" style="margin: 13px 0">
                        <form id="defaultForm" class="form-horizontal" method="post"
                              action="<%=path%>/system/manufacturerManage/updateOrAdd/manufacturer">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">厂商代码:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_orgCode" name="orgCode"
                                                   value="${manufacturer.orgCode}" placeholder="Enter 厂商代码:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">厂商名称:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_orgName" name="orgName"
                                                   value="${manufacturer.orgName}" placeholder="Enter 厂商名称:" required/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系人1:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMan" name="linkMan"
                                                   value="${manufacturer.linkMan}" placeholder="Enter 联系人1:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系电话1:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkPhone" name="linkPhone"
                                                   value="${manufacturer.linkPhone}" placeholder="Enter 联系电话1:"
                                                   required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系人2:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMan_two" name="linkManTwo"
                                                   value="${manufacturer.linkManTwo}" placeholder="Enter 联系人2:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系电话2:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkPhone_two" name="linkPhoneTwo"
                                                   value="${manufacturer.linkPhoneTwo}" placeholder="Enter 联系电话2:"
                                                   required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系邮箱1:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMail" name="linkMail"
                                                   value="${manufacturer.linkMail}" placeholder="Enter 联系邮箱1:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系邮箱2:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMailTwo" name="linkMailTwo"
                                                   value="${manufacturer.linkMailTwo}" placeholder="Enter 联系邮箱2:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系邮箱3:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMailThree" name="linkMailThree"
                                                   value="${manufacturer.linkMailThree}" placeholder="Enter 联系邮箱3:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系邮箱4:</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" id="edit_linkMailFour" name="linkMailFour"
                                                   value="${manufacturer.linkMailFour}" placeholder="Enter 联系邮箱4:" required/>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">状态:</label>
                                        <div class="col-sm-6">
                                            <select class="form-control input-sm mb15" name="status">
                                                <option value="1"
                                                        <c:if test="${manufacturer.status == '1'}">selected</c:if>>启用
                                                </option>
                                                <option value="0"
                                                        <c:if test="${manufacturer.status == '0'}">selected</c:if> >禁用
                                                </option>

                                            </select>
                                        </div>
                                    </div>

                                    <input type="hidden" id="edit_id" name="id" value="${manufacturer.id}"/>
                                    <input type="hidden" id="edit_insertedBy" value="${manufacturer.insertedBy}"
                                           name="insertedBy"/>
                                    <input type="hidden" id="edit_insertedAt" value="${manufacturer.insertedAt}"
                                           name="insertedAt"/>
                                    <input type="hidden" id="edit_orgType" value="${manufacturer.orgType}"
                                           name="orgType"/>
                                    <input type="hidden" id="edit_parentId" value="${manufacturer.parentId}"
                                           name="parentId"/>
                                    <div class="col-sm-8 col-btn-12">
                                        <button type="submit" class="btn btn-primary" id="editRoleBtn">保存</button>
                                        <button type="button" class="btn btn-default"
                                                onclick="window.location.href='<%=path%>/bus/meter/returnMeterGive?url=<%=path%>/system/manufacturerManage/manufacturer/list&flg=getAllManufacturer'">
                                            返回
                                        </button>
                                    </div>
                                </div>

                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="gray-screen"></div>
</body>
<script type="text/javascript" src="<%=basePath%>js/validate/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/rem.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=basePath%>js/validate/bootstrapValidator.js"></script>
<script type="text/javascript" src="<%=basePath%>js/validate/zh_CN.js"></script>
<script type="text/javascript" src="<%=basePath%>js/bootstrap-3.3.6/dist/js/bootstrap.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=basePath%>js/common/dialog.3.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#defaultForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {}
        }).on('success.form.bv', function (e) {
            // Prevent form submission
            e.preventDefault();

            // Get the form instance
            var $form = $(e.target);

            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');

            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function (result) {

                if (result.message != undefined) {
                    var code = result.code;
                    var grayScreen = document.getElementById("gray-screen");
                    Dialog({
                        "msg": '<div class="D_alert">' + result.message + '</div>',
                        "title": "提示",
                        "showButtons": true,
                        "cancelButton": false,
                        "onComplete": function () {
                            if (code != 1) {
                                $("body").empty();
                                window.location.href = '<%=path%>/bus/meter/returnMeterGive?url=<%=path%>/system/manufacturerManage/manufacturer/list&flg=getAllManufacturer';
                            }
                        }
                    });
                } else {
                    window.location.href = '<%=path%>/bus/meter/returnMeterGive?url=<%=path%>/system/manufacturerManage/manufacturer/list&flg=getAllManufacturer';
                }
            }, 'json');
        });

        //清空搜索条件
        $(".clearForm").click(function () {
            $("#form").find("input").val("");
        });
    });
</script>
</html>
